package com.qf.job;

import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;

/**
 * @author 何星宇
 * @version V1.0
 * @Date 2021/11/15 15:04
 */

@Component
public class MyJob implements SimpleJob {
    @Override
    public void execute(ShardingContext context) {
        int shardingItem = context.getShardingItem();
        switch (shardingItem) {
            case 0:
                // do something by sharding item 0
                System.out.println("000000000000000");
                break;
            case 1:
                // do something by sharding item 1
                System.out.println("111111111111111");
                break;
            case 2:
                // do something by sharding item 2
                System.out.println("222222222222222");
                break;
            // case n: ...
        }
    }
}
